package com.funcablaze.component.view;

import com.funcablaze.component.control.Graphic;
import com.funcablaze.component.control.Theme;
import com.funcablaze.window.Frame;

public class LinerLayout extends View {
	
	protected int spacing = 5;
	protected BaseLayout.LinerLayout linerLayout = BaseLayout.LinerLayout.Vertical;
	
	public LinerLayout() {
	}
	
	@Override
	public void addChild(View child) {
		super.addChild(child);
	}
	
	@Override
	public void _draw(Graphic graphic, Theme.ThemeType theme) {
		super._draw(graphic, theme);
	}
	
	/**
	 * 设置布局类型
	 * @param layout 布局类型，可选值：vertical、horizontal
	 */
	public void setLayout(String layout) {
		if (layout.equals("vertical")) {
			this.linerLayout = BaseLayout.LinerLayout.Vertical;
		} else if (layout.equals("horizontal")) {
			this.linerLayout = BaseLayout.LinerLayout.Horizontal;
		} else {
			throw new IllegalArgumentException("无效的布局类型：" + layout);
		}
	}
	
	/**
	 * 设置子元素之间的间距
	 * @param spacing 间距
	 */
	public void setSpacing(int spacing) {
		this.spacing = spacing;
	}
}
